<template>
  <div class="app">
    <h2 ref="title">当前求和为：{{ sum }}</h2>
    <button @click="sum += 1">点我sum+1</button>
    <button @click="showH2">打印h2</button>
    <Person/>
  </div>
</template>

<script>
  import Person from './components/Person.vue'

  export default {
    name:'App',
    components:{Person},
    data() {
      return {
        sum:1
      }
    },
    methods: {
      showH2(){
        console.log(this.$refs.title)
      }
    },
  }
</script>

<style>
  .app {
    background-color: #ddd;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px;
  }
</style>